package com.sgcc.system.api.factory;

import com.sgcc.common.core.web.domain.AjaxResult;
import com.sgcc.system.api.RemoteDeptService;
import com.sgcc.system.api.RemoteDistrictService;
import com.sgcc.system.api.domain.SysDept;
import com.sgcc.system.api.domain.SysDistrict;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 用户部门服务降级处理
 * 
 * @author sgcc
 */
@Component
public class RemoteDistrictFallbackFactory implements FallbackFactory<RemoteDistrictService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteDistrictFallbackFactory.class);

    @Override
    public RemoteDistrictService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteDistrictService()
        {
			@Override
			public SysDistrict getOrgNO(String deptId) {
				// TODO Auto-generated method stub
                SysDistrict SysDistrict= new SysDistrict();
                log.info("获取单位编码失败请稍后在试");
				return SysDistrict;
			}

            @Override
            public SysDistrict getOrgNOByDistrictId(String districtId) {
                // TODO Auto-generated method stub
                SysDistrict SysDistrict= new SysDistrict();
                log.info("获取单位编码失败请稍后在试");
                return SysDistrict;
            }

        };
    }
}
